﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using pygs.Classes;

namespace pygs.UI
{
    public partial class WinUIFormMain : Form
    {
        private WinUI _ui;
        public WinUI ui { get { return _ui; } }
        
        public WinUIFormMain(WinUI ui)
        {
            _ui = ui;
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            ui.Exit();
        }

        protected delegate void SetLocationDelegate(DegreesMinutesSeconds latitude, DegreesMinutesSeconds longitude);

        protected void DoSetLocation(DegreesMinutesSeconds latitude, DegreesMinutesSeconds longitude)
        {
            lblLocation.Text = string.Format("lat={0}, long={1}", latitude, longitude);
        }

        public void SetLocation(DegreesMinutesSeconds latitude, DegreesMinutesSeconds longitude)
        {
            this.Invoke(new SetLocationDelegate(DoSetLocation), new object[] {latitude, longitude});
        }
    }
}